package com.itbaizhan.service.impl;

import com.itbaizhan.dao.impl.UserDao;
import com.itbaizhan.dao.impl.impl.UserDaoImpl;
import com.itbaizhan.pojo.Users;
import com.itbaizhan.service.UsersService;

import java.util.List;

public class UsersServiceImpl implements UsersService {

    @Override
    public Users findUsersById(int userid) {
        //根据用户Id查询用户业务
        //用接口实现接口实现类  增加方法时，这里不用修改，只要在接口与接口实现类增加
        //充分利用接口隔离原则
        UserDao ud = new UserDaoImpl();
        return ud.selectUserById(userid);
    }

    @Override
    public int modifyUsersById(Users users) {
        UserDao ud = new UserDaoImpl();
        return ud.updateUsersByiId(users);
    }

    @Override
    public List<Users> findUsersByLikeName(String username) {
        UserDao ud = new UserDaoImpl();
        return ud.selectUsersByLikeName(username);
    }

    @Override
    public Users findUsers(int userid) {
        UserDao ud = new UserDaoImpl();

        return ud.selectUsers(userid);
    }
}
